cmake_minimum_required(VERSION 3.14)
project(QuickStartC)

# 检查GCC版本
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 7.3.0)
    message(FATAL_ERROR "GCC version ${CMAKE_C_COMPILER_VERSION} must not be less than 7.3.0")
endif()

# 包含头文件目录
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

# 动态库目录
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)

# 可执行文件
add_executable(mindspore_mnist_demo main.c)

# 链接库
target_link_libraries(
    mindspore_mnist_demo
    -Wl,--whole-archive mindspore-lite -Wl,--no-whole-archive
    -Wl,--whole-archive mindspore_glog -Wl,--no-whole-archive
    pthread
    dl
)
